import os

from dotenv import load_dotenv, find_dotenv
from pydantic.v1 import BaseSettings
from typing import List


class Config(BaseSettings):
    # 加载环境变量
    load_dotenv()
    # 调试模式
    APP_DEBUG = os.getenv("APP_DEBUG")
    # 项目信息
    VERSION = os.getenv("VERSION")
    PROJECT_NAME = os.getenv("PROJECT_NAME")
    DESCRIPTION = os.getenv("PROJECT_NAME")

 # 跨域请求
    CORS_ORIGINS: List = ["*"]
    CORS_ALLOW_CREDENTIALS: bool = True
    CORS_ALLOW_METHODS: List = ["*"]
    CORS_ALLOW_HEADERS: List = ["*"]
    # Jwt
    JWT_SECRET_KEY="09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7"
    JWT_ALGORITHM="HS256"
    JWT_ACCESS_TOKEN_EXPIRE_MINUTES=1440
    JWT_REFRESH_TOKEN_EXPIRE_DAYS = 7 #refreshToken过期时间配置
    SWAGGER_UI_OAUTH2_REDIRECT_URL = "/test/test/oath2"
    # 数据库信息
    # mysql数据库信息
    MYSQL_HOST = os.getenv("MYSQL_HOST")
    MYSQL_PORT = os.getenv("MYSQL_PORT")
    MYSQL_DATABASE = os.getenv("MYSQL_DATABASE")
    MYSQL_USERNAME = os.getenv("MYSQL_USERNAME")
    MYSQL_PASSWORD = os.getenv("MYSQL_PASSWORD")


settings = Config()
